home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 076-100 / disk_087 / id-handler / readme < prev   
Text File  |  1992-05-06  |  4KB  |  134 lines

  1. README file for ID-handler (version 1.0 13-Jun-87)
  2. ==================================================
  3.  
  4. This program and source are freely distributable, provided the file headers
  5. remain intact (i.e., my name is on them!!!).
  6.  
  7. Ed Puckett accepts no responsibility for others' use of this program.
  8.  
  9. ...but you shouldn't have any problems!
  10.  
  11.  
  12. WHAT IS THIS?
  13. -------------
  14. ID-handler is an AmigaDOS device.  It supports OPEN, CLOSE and READ.
  15. It is used to generate unique identifiers.
  16.  
  17. Every time someone opens ID:, it generates a new 16 digit decimal number.
  18. This number can then be read (in ASCII) from the FileHandle obtained
  19. by opening ID:.  EOF returns on all reads subsequent to reading the
  20. last digit.
  21.  
  22. ID: starts with number 0000000000000000 and proceeds in sequence.
  23. You are guaranteed to get a unique number from it since it is a handler,
  24. and communication with it from two processes cannot collide.
  25.  
  26.  
  27. USAGE
  28. -----
  29. You can use TYPE to access ID:, as in:
  30.  
  31.     TYPE ID:
  32.  
  33. However, typical usage is in a program:
  34.  
  35.     char  *gensym (sym, buf, bufsize)
  36.  
  37.     char  *sym, *buf;
  38.     int   bufsize;
  39.  
  40.     { int    symlen;
  41.       BPTR    fh;
  42.  
  43.       symlen= strlen (sym);
  44.       if ( ((symlen + 1 + 16) > bufsize) ||
  45.            ((fh= Open ("ID:", MODE_OLDFILE)) == 0) )
  46.         return NULL;
  47.  
  48.       strcpy (buf, sym);
  49.       Read (fh, (buf + symlen), 16);     /* append digits to symbol */
  50.       buf[symlen + 16]= '\0';
  51.       Close (fh);
  52.  
  53.       return buf;
  54.     }
  55.  
  56.  
  57. INSTALLATION
  58. ------------
  59. 1. Perform the following:
  60.     <uudecode ihl.uue to produce ID-handler-l>
  61.     <uudecode ih.uue  to produce ID-handler>
  62.     Copy ID-handler-l L:ID-handler-loader
  63.     Copy ID-handler   L:ID-handler
  64.  
  65. 2. Add to S:Startup-Sequence (do not include !'s - they denote start of line):
  66.     !Mount ID:
  67.     !Type >NIL: ID:
  68.  
  69. 3. Add to DEVS:Mountlist (do not include !'s - they denote start of line):
  70.     !ID:     Handler = L:ID-handler-loader
  71.     !     Stacksize = 1000
  72.     !     Priority = 5
  73.     !#
  74.  
  75. 4. Reboot
  76.  
  77.  
  78. NOTES ON INSTALLATION
  79. ---------------------
  80. * You can skip the reboot, and just perform the "Mount" and "Dir" from the
  81.   startup-sequence manually.
  82.  
  83. * After the "Type", the ID-handler is loaded into the system, and the files
  84.   "L:ID-handler-loader" and "L:ID-handler" will not be accessed until the
  85.   next reboot.    This means you may remove them from L: if you want (until
  86.   next    reboot).  I do this because I copy L: into Ram:.
  87.  
  88. * TO CHANGE THE HANDLER NAME: change "ID:" to whatever you want (e.g., "NUM:")
  89.   in the following 2 files:
  90.     DEVS:Mountlist        (1 occurrence)
  91.     S:Startup-Sequence    (2 occurrences)
  92.  
  93. * Feel free to shorten or otherwise change the names "ID-handler-loader"
  94.   and "ID-handler".  Just be sure to reflect those changes in
  95.   "S:Startup-Sequence" and "DEVS:Mountlist".
  96.  
  97.  
  98. WHAT IS THIS SILLY "LOADER" FILE?
  99. ---------------------------------
  100. According to _The_AmigaDOS_Manual_ (Bantam Books, Feb 1986), page 291:
  101.  
  102.     If you write your device handler in C, you cannot use the automatic
  103.     load and process creation provided by the kernel.  In this case you
  104.     must load the code yourself . . . .
  105.  
  106. Well, I know others have gotten around this, and I did, too.  However, in my
  107. "prelude" version of the handler, I noticed that the handler would take about
  108. 3 seconds to "Mount" (after first access to it).  This made me very nervous -
  109. visions of wild linking through memory, etc.  The loader version mounts
  110. almost immediately.
  111.  
  112. Anyway, due to my (possibly unfounded) paranoia, I instead use the BCPL-like
  113. assembly module "ID-handler-loader" which LoadSeg()'s ID-handler.  There
  114. are undoubtedly better ways of handling this, but this works and, for me,
  115. it is not too annoying to put up with the extra file.
  116.  
  117.  
  118. COMPILATION
  119. -----------
  120. The supplied C source files were compiled with Lattice v3.03.
  121. The assembly programs were assembled using the Commodore Assembler.
  122.  
  123. I use an EXECUTE file "cc" to drive the compiler.  It is supplied.
  124.  
  125.  
  126. INQUIRIES / COMMENTS / SUGGESTIONS
  127. ----------------------------------
  128. Ed Puckett
  129.  
  130. US Mail:  MIT Branch PO - PO Box 61
  131.       Cambridge, MA  02139
  132.  
  133. E Mail:  ...!ihnp4!mit-eddie!mit-oz!qix
  134.